import Vue from 'vue'
let defaultConfig1 = {
    visible1: false,
    title1: "弹框",
    width1: '80%',
    fullscreen1: false,
    closeOnClickModal1: false,
    showFirstFoot: false,
    beforeClose1: ()=>{
        twoLevelDialogVuex.state.dialogStatus2.visible2 = false
        twoLevelDialogVuex.state.dialogStatus1.visible1 = false
    },
    // destroyOnClose1: true,
}
let defaultConfig2 = {
    visible2: false,
    title2: "弹框",
    width2: '60%',
    fullscreen2: false,
    showTwoFoot: false,
    closeOnClickModal2: false,
    beforeClose1: ()=>{
        twoLevelDialogVuex.state.dialogStatus2.visible2 = false
    },
    // destroyOnClose2: true,
}
const twoLevelDialogVuex = {
    namespaced: true,
    state: {
        dialogStatus1: {
            // visible1: false,
            // title1: "弹框",
            // width1: '80%',
            // fullscreen1: false,
            // closeOnClickModal1: false,
            // beforeClose1: ()=>{
            //     state.visible2 = false
            // },
            // destroyOnClose1: true,
        },

        dialogStatus2: {
            // visible2: false,
            // title2: "弹框",
            // width2: '60%',
            // fullscreen2: false,
            // closeOnClickModal2: false,
            // beforeClose2: ()=>{},
            // destroyOnClose2: true,
        }
    },
    mutations: {
        ChangeOneDialog(state, val) {
            state.dialogStatus1 = {
                ...defaultConfig1,
                ...val
            };
        },
        ChangeTwoDialog(state, val) {
            if(state.dialogStatus1.visible1){
                state.dialogStatus2 = {
                    ...defaultConfig2,
                    ...val
                };
            }
        },

    },
    actions: {

    },
}

export default twoLevelDialogVuex
